package com.peng.store;


import dev.langchain4j.data.segment.TextSegment;
import dev.langchain4j.store.embedding.EmbeddingStore;
import dev.langchain4j.store.embedding.qdrant.QdrantEmbeddingStore;
import io.qdrant.client.QdrantClient;
import io.qdrant.client.QdrantGrpcClient;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * @author love_ovo
 * @ClassName QdrantEmbeddingStore.java
 * @createTime 2025年05月26日 14:52:00
 */
@Component
public class QdrantEmbeddingStores {

    @Bean
    public QdrantClient qdrantClient(){
        QdrantGrpcClient.Builder grpcClientBuilder =
                QdrantGrpcClient.newBuilder("192.168.37.130",
                        6334, false);
        return new QdrantClient(grpcClientBuilder.build());
    }

    @Bean(name = "qdrantEmbeddingStore")
    public EmbeddingStore<TextSegment> embeddingStore() {
        return QdrantEmbeddingStore.builder()
                .host("192.168.37.130")
                .port(6334)
                .collectionName("xiaozhi-qdrant")
                .build();
    }

}
